package com.jiangnan.api.service

import com.jiangnan.entity.LoginInfo
import com.jiangnan.entity.Res
import com.jiangnan.entity.User
import com.jiangnan.entity.UserBorrowCertificate
import okhttp3.MultipartBody
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Part
import retrofit2.http.Path
import retrofit2.http.Query

interface UserApiService {

    /**
     * 修改用户信息接口
     */
    @PUT("/user/update")
    suspend fun updateUserInfo(
        @Query("userId") userId: Int,
        @Body userInfo: LoginInfo
    ) : Res<String>

    /**
     * 上传图片接口
     */
    @Multipart
    @POST("/upload")
    suspend fun uploadImage(
        @Part file: MultipartBody.Part
    ): Response<Res<String>>

    @GET("user/{id}")
    suspend fun getUserById(@Path("id") userId: Long): Res<User>

    @GET("user/certificate/{id}")
    suspend fun getCertificateById(@Path("id") userId: Long): Res<UserBorrowCertificate>


}